/**
 * 
 */
package db_manager;

import static org.junit.Assert.*;

import java.io.File;

import org.junit.Test;

/**
 * This class is for testing functions from class manager
 */
public class ManagerTest 
{

	/**
	 * Test method for {@link db_manager.Manager#validateUser(java.lang.String, java.lang.String)}.
	 */
	@Test
	public void testValidateUser() 
	{
		//there is really currently a user name 'a' with password '1234'
		Manager manager = Manager.getInstance();
		assertTrue(manager.validateUser("a", "1234"));
	}
	
	/**
	 * Test method for {@link db_manager.Manager#validateUser(java.lang.String, java.lang.String)}.
	 */
	@Test
	public void testValidateUser2() 
	{
		//there is currently no user named 'c' with password '1111'
		Manager manager = Manager.getInstance();
		assertFalse(manager.validateUser("c", "1111"));
	}
	
	/**
	 * Test method for {@link db_manager.Manager#convFileToByte(java.io.File)}.
	 */
	@Test
	public void testConvFileToByte() 
	{
		Manager manager = Manager.getInstance();
		//this file is currently exist on my desktop and contain the letter 'a'
		File file = new File("C:\\Users\\Admin\\Desktop\\a.txt");
		byte[] b = new byte[1];
		b[0] = 97;
		assertArrayEquals(b, manager.convFileToByte(file));
	}

}
